//
//  OrderDetailsView.m
//  DaiShengInvest
//
//  Created by 张睿 on 2017/7/4.
//  Copyright © 2017年 davinci. All rights reserved.
//

#import "OrderDetailsView.h"



//  字体颜色
//#define RED_COLOR   ColorWithRGB(0xf54040)
//#define GREEN_COLOR  ColorWithRGB(0x1bc360)


@interface OrderDetailsView ()

//==
@property (nonatomic, weak)UILabel * calculateLabel;

@property (nonatomic, weak)UILabel * operationLabel;

@property (nonatomic, weak)UILabel * moneyCountLabel;
//==
@property (nonatomic, weak)UIView * oneLineView;
//==
@property (nonatomic, weak)UILabel * kindInformationLabel;
//==
@property (nonatomic, weak)UILabel * kindLabel;
//==
@property (nonatomic, weak)UILabel * transactionCountLabel;
//==
@property (nonatomic, weak)UILabel * ensureLabel;
//==
@property (nonatomic, weak)UILabel * poundageLabel;
//==
@property (nonatomic, weak)UILabel * accrualLabel;
//==
@property (nonatomic, weak)UIView * twoLineView;

@property (nonatomic, weak)UILabel * orderInformationLabel;
//==
@property (nonatomic, weak)UILabel * startPriceLabel;
//==
@property (nonatomic, weak)UILabel * endPriceLabel;
//==
@property (nonatomic, weak)UILabel * startKindLabel;
//==
@property (nonatomic, weak)UILabel * endKindLabel;
//==
@property (nonatomic, weak)UILabel * startTimeLabel;
//==
@property (nonatomic, weak)UILabel * orderNumberLabel;




@end

@implementation OrderDetailsView



- (instancetype)initWithFrame:(CGRect)frame{
    
    if ([super initWithFrame:frame]) {
        
        [self setupUI];
    }
    
    return self;
}




- (void)setupUI{
    
    UILabel * calculateLabel = [UILabel new];
    
    calculateLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    calculateLabel.textColor = ColorWithRGB(0xffffff);
    calculateLabel.text = @"计算盈亏($)";
    
    self.calculateLabel = calculateLabel;
    
    [self addSubview:self.calculateLabel];
    
    
    UILabel * operationLabel = [UILabel new];
    
    operationLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    operationLabel.textColor = GREEN_COLOR;
    //可变数据
    operationLabel.text = @"看多";
    
    self.operationLabel = operationLabel;
    
    [self addSubview:self.operationLabel];
    
    
    UILabel * moneyCountLabel = [UILabel new];
    
    moneyCountLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    moneyCountLabel.textColor = GREEN_COLOR;
    //可变数据
    moneyCountLabel.text = @"-$109.79";
    
    self.moneyCountLabel = moneyCountLabel;
    
    [self addSubview:self.moneyCountLabel];
    
    
    UIView * oneLineView = [UIView new];
    
    oneLineView.backgroundColor = [UIColor whiteColor];
    oneLineView.alpha = 0.1;
    
    self.oneLineView = oneLineView;
    
    [self addSubview:self.oneLineView];
    
    UILabel * kindInformationLabel = [UILabel new];
    
    kindInformationLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    kindInformationLabel.textColor = ColorWithRGB(0xa2a2a2);
    kindInformationLabel.text = @"品种信息";
    
    self.kindInformationLabel = kindInformationLabel;
    
    [self addSubview:self.kindInformationLabel];
    
    UILabel * kindLabel = [UILabel new];
    
    kindLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    kindLabel.textColor = ColorWithRGB(0xa2a2a2);
    kindLabel.text = @"交易品种";
    
    self.kindLabel = kindLabel;
    
    [self addSubview:self.kindLabel];
    //transactionCountLabel
    UILabel * transactionCountLabel = [UILabel new];
    
    transactionCountLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    transactionCountLabel.textColor = ColorWithRGB(0xa2a2a2);
    transactionCountLabel.text = @"交易数量";
    
    self.transactionCountLabel = transactionCountLabel;
    
    [self addSubview:self.transactionCountLabel];
    
    UILabel * ensureLabel = [UILabel new];
    
    ensureLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    ensureLabel.textColor = ColorWithRGB(0xa2a2a2);
    ensureLabel.text = @"保证金";
    
    self.ensureLabel = ensureLabel;
    
    [self addSubview:self.ensureLabel];
    
    UILabel * poundageLabel = [UILabel new];
    
    poundageLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    poundageLabel.textColor = ColorWithRGB(0xa2a2a2);
    poundageLabel.text = @"手续费";
    
    self.poundageLabel = poundageLabel;
    
    [self addSubview:self.poundageLabel];
    //accrualLabel
    
    UILabel * accrualLabel = [UILabel new];
    
    accrualLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    accrualLabel.textColor = ColorWithRGB(0xa2a2a2);
    accrualLabel.text = @"隔夜利息";
    
    self.accrualLabel = accrualLabel;
    
    [self addSubview:self.accrualLabel];
    
    UIView * twoLineView = [UIView new];
    
    twoLineView.backgroundColor = [UIColor whiteColor];
    twoLineView.alpha = 0.1;
    
    self.twoLineView = twoLineView;
    
    [self addSubview:self.twoLineView];
    
    
    UILabel * orderInformationLabel = [UILabel new];
    
    orderInformationLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    orderInformationLabel.textColor = ColorWithRGB(0xa2a2a2);
    orderInformationLabel.text = @"订单信息";
    
    self.orderInformationLabel = orderInformationLabel;
    
    [self addSubview:self.orderInformationLabel];
    
    UILabel * startPriceLabel = [UILabel new];
    
    startPriceLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    startPriceLabel.textColor = ColorWithRGB(0xa2a2a2);
    startPriceLabel.text = @"开仓价";
    
    self.startPriceLabel = startPriceLabel;
    
    [self addSubview:self.startPriceLabel];
    
    
    UILabel * endPriceLabel = [UILabel new];
    
    endPriceLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    endPriceLabel.textColor = ColorWithRGB(0xa2a2a2);
    endPriceLabel.text = @"平仓价";
    
    self.endPriceLabel = endPriceLabel;
    
    [self addSubview:self.endPriceLabel];
    
    
    UILabel * startKindLabel = [UILabel new];
    
    startKindLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    startKindLabel.textColor = ColorWithRGB(0xa2a2a2);
    startKindLabel.text = @"开仓类型";
    
    self.startKindLabel = startKindLabel;
    
    [self addSubview:self.startKindLabel];

    
    UILabel * endKindLabel = [UILabel new];
    
    endKindLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    endKindLabel.textColor = ColorWithRGB(0xa2a2a2);
    endKindLabel.text = @"平仓类型";
    
    self.endKindLabel = endKindLabel;
    
    [self addSubview:self.endKindLabel];
    
    
    UILabel * startTimeLabel = [UILabel new];
    
    startTimeLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    startTimeLabel.textColor = ColorWithRGB(0xa2a2a2);
    startTimeLabel.text = @"开仓时间";
    
    self.startTimeLabel = startTimeLabel;
    
    [self addSubview:self.startTimeLabel];
    
    
    UILabel * orderNumberLabel = [UILabel new];
    
    orderNumberLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:15 * SCREENH6];
    orderNumberLabel.textColor = ColorWithRGB(0xa2a2a2);
    orderNumberLabel.text = @"订单编号";
    
    self.orderNumberLabel = orderNumberLabel;
    
    [self addSubview:self.orderNumberLabel];
}



- (void)layoutSubviews{
    
    [self.calculateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self).offset(20 * SCREENH6);
        make.top.mas_equalTo(self).offset(84 * SCREENH6);
    }];
    
    [self.operationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.calculateLabel);
        make.centerX.mas_equalTo(self);
    }];
    
    [self.moneyCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.operationLabel);
        make.leading.mas_equalTo(self.operationLabel.mas_trailing).offset(90 * SCREENH6);
    }];
    
    [self.oneLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.mas_equalTo(self);
        make.height.mas_equalTo(1 * SCREENH6);
        make.top.mas_equalTo(self).offset(120 * SCREENH6);
    }];
    
    [self.kindInformationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.oneLineView.mas_bottom).offset(18 * SCREENH6);
        make.leading.mas_equalTo(self.calculateLabel);
    }];
    
     [self.kindLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.kindInformationLabel.mas_bottom).offset(15 * SCREENH6);
        make.leading.mas_equalTo(self.kindInformationLabel);
    }];
    
    [self.transactionCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.kindLabel);
        make.leading.mas_equalTo(self).offset(253 * SCREENH6);
    }];
    
    [self.ensureLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.kindLabel);
        make.top.mas_equalTo(self.kindLabel.mas_bottom).offset(13 * SCREENH6);
    }];
    
    [self.poundageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.transactionCountLabel);
        make.centerY.mas_equalTo(self.ensureLabel);
    }];
    
    [self.accrualLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.ensureLabel);
        make.top.mas_equalTo(self.ensureLabel.mas_bottom).offset(13 * SCREENH6);
    }];
    
    [self.twoLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.height.mas_equalTo(self.oneLineView);
        make.top.mas_equalTo(self.accrualLabel.mas_bottom).offset(18 * SCREENH6);
    }];
    
    [self.orderInformationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.accrualLabel);
        make.top.mas_equalTo(self.twoLineView.mas_bottom).offset(18 * SCREENH6);
    }];
    
    [self.startPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.orderInformationLabel);
        make.top.mas_equalTo(self.orderInformationLabel.mas_bottom).offset(23 * SCREENH6);
    }];
    
    [self.endPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.startPriceLabel);
        make.leading.mas_equalTo(self.poundageLabel);
    }];
    
    [self.startKindLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.startPriceLabel);
        make.top.mas_equalTo(self.startPriceLabel.mas_bottom).offset(20 * SCREENH6);
    }];
    
    [self.endKindLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.startKindLabel);
        make.leading.mas_equalTo(self).offset(241 * SCREENH6);
    }];
    
    [self.startTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.startKindLabel);
        make.top.mas_equalTo(self.startKindLabel.mas_bottom).offset(20 * SCREENH6);
    }];
    
    [self.orderNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.startTimeLabel);
        make.top.mas_equalTo(self.startTimeLabel.mas_bottom).offset(27 * SCREENH6);
    }];
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
